home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 22 / CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso / PowerPC / Programming / vbcc / machines / amiga68k / libsrc / extra / strnicmp.c < prev   
Encoding:
C/C++ Source or Header  |  1998-02-01  |  530 b   |  23 lines

  1. #include <ctype.h>
  2. #include <string.h>
  3.  
  4. /*
  5. ** strnicmp() - Compare n nr of chars in two strings incasesensitivly.
  6. **
  7. ** Made by Kasper B. Graversen (c) 1996
  8. **
  9. ** fixed by phx 01/98
  10. **
  11. ** This is freeware - use at own risc.
  12. */
  13.  
  14. int strnicmp(const char *str1, const char *str2, size_t n)
  15. {
  16.     if(n==0) return 0;
  17.     while(--n && tolower((unsigned char)*str1)==tolower((unsigned char)*str2)){
  18.         if(!*str1) return(0);
  19.         str1++;str2++;
  20.     }
  21.     return(tolower(*(unsigned char *)str1)-tolower(*(unsigned char *)str2));
  22. }
  23.